package tinglema.server.entity.view;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import tinglema.server.entity.domain.Consumer;

import java.util.Date;

/**
 * @author delucia
 * @version 1.0.0
 * @date 2025-04-21
 * @apiNote
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserView {

        /**
         * 用户id
         */
        private Integer id;

        /**
         * 用户姓名
         */
        private String username;

        /**
         * 性别
         */
        private Integer sex;

        /**
         * 电话
         */
        private String phoneNum;

        /**
         * 邮箱
         */
        private String email;

        /**
         * 用户出生年月日
         */
        private Date birth;

        /**
         * 简介
         */
        private String introduction;

        /**
         * 籍贯
         */
        private String location;

        /**
         * 用户头像路径
         */
        private String avator;

        public static UserView transter (Consumer con) {
                UserViewBuilder builder =  new UserViewBuilder();
                return builder.avator(con.getAvator())
                        .avator(con.getAvator())
                        .birth(con.getBirth())
                        .email(con.getEmail())
                        .id(con.getId())
                        .introduction(con.getIntroduction())
                        .location(con.getLocation())
                        .phoneNum(con.getPhoneNum())
                        .sex(con.getSex())
                        .username(con.getUsername()).build();
        }
}
